﻿//-----------------------------------------------------------------------
// <copyright file="FormSettings.cs" company="Panchal Softwares">
//     Copyright (c) Panchal Softwares. All rights reserved.
// </copyright>
// <author>Karn Panchal</author>
//-----------------------------------------------------------------------

/// <summary>
/// namespace Text Finder GUI.
/// </summary>
namespace PanchalSoftwares.TextFinder.GUI
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using Properties;

    /// <summary>
    /// Partial Class Form Settings.
    /// </summary>
    public partial class FormSettings : Form
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="FormSettings"/> class.
        /// </summary>
        public FormSettings()
        {
            this.InitializeComponent();
        }

        /// <summary>
        /// Handles the Load event of the FormSettings control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void FormSettings_Load(object sender, EventArgs e)
        {
            Settings item = new Settings();
            if (item.CaseSensetiveSearch)
            {
                this.checkBoxCaseSensitive.Checked = true;
            }
            else
            {
                this.checkBoxCaseSensitive.Checked = false;
            }
        }

        /// <summary>
        /// Handles the Click event of the ButtonOk control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void ButtonOk_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        /// <summary>
        /// Handles the FormClosing event of the FormSettings control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="FormClosingEventArgs"/> instance containing the event data.</param>
        private void FormSettings_FormClosing(object sender, FormClosingEventArgs e)
        {
            Settings item = new Settings();
            if (this.checkBoxCaseSensitive.Checked)
            {
                item.CaseSensetiveSearch = true;
            }
            else
            {
                item.CaseSensetiveSearch = false;
            }

            item.Save();
        }
    }
}
